package com.EVO.controller;

import com.EVO.dao.UserDao;
import com.EVO.util.Util;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;

public class UserDeleteServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String userId = request.getParameter("userId");
        int result = 0;
        PrintWriter out = null;
        UserDao dao = new UserDao();
        result = dao.delete(userId);
        response.setContentType("text/html;charset=utf-8");
        out = response.getWriter();
        if(result == 1){
            out.print("<center><font style='color:red;font-size:40px'>删除成功！！</font></center>");
        }else{
            out.print("<center><font style='color:red;font-size:40px'>删除失败！！</font></center>");
        }

    }
}
